package cn.edu.scau.dropship.mapper;

import cn.edu.scau.dropship.entity.Wallets;
import cn.edu.scau.dropship.entity.WalletsExample;
import java.util.List;
import org.apache.ibatis.annotations.Arg;
import org.apache.ibatis.annotations.ConstructorArgs;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface WalletsMapper {
    @SelectProvider(type=WalletsSqlProvider.class, method="countByExample")
    long countByExample(WalletsExample example);

    @DeleteProvider(type=WalletsSqlProvider.class, method="deleteByExample")
    int deleteByExample(WalletsExample example);

    @Delete({
        "delete from wallets",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into wallets (id, password, ",
        "money, user_id)",
        "values (#{id,jdbcType=INTEGER}, #{password,jdbcType=VARCHAR}, ",
        "#{money,jdbcType=DOUBLE}, #{userId,jdbcType=INTEGER})"
    })
    int insert(Wallets record);

    @InsertProvider(type=WalletsSqlProvider.class, method="insertSelective")
    int insertSelective(Wallets record);

    @SelectProvider(type=WalletsSqlProvider.class, method="selectByExample")
    @ConstructorArgs({
        @Arg(column="id", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true),
        @Arg(column="password", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="money", javaType=Double.class, jdbcType=JdbcType.DOUBLE),
        @Arg(column="user_id", javaType=Integer.class, jdbcType=JdbcType.INTEGER)
    })
    List<Wallets> selectByExample(WalletsExample example);

    @Select({
        "select",
        "id, password, money, user_id",
        "from wallets",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ConstructorArgs({
        @Arg(column="id", javaType=Integer.class, jdbcType=JdbcType.INTEGER, id=true),
        @Arg(column="password", javaType=String.class, jdbcType=JdbcType.VARCHAR),
        @Arg(column="money", javaType=Double.class, jdbcType=JdbcType.DOUBLE),
        @Arg(column="user_id", javaType=Integer.class, jdbcType=JdbcType.INTEGER)
    })
    Wallets selectByPrimaryKey(Integer id);

    @UpdateProvider(type=WalletsSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Wallets record, @Param("example") WalletsExample example);

    @UpdateProvider(type=WalletsSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Wallets record, @Param("example") WalletsExample example);

    @UpdateProvider(type=WalletsSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Wallets record);

    @Update({
        "update wallets",
        "set password = #{password,jdbcType=VARCHAR},",
          "money = #{money,jdbcType=DOUBLE},",
          "user_id = #{userId,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Wallets record);
}